package org.com.ashen.service.dao;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.apache.commons.lang3.StringUtils;
import org.com.ashen.dal.dataobject.SaasAppSession;
import org.com.ashen.dal.mapper.SaasAppSessionMapper;


@Service("saasAppSessionDao")
public class SaasAppSessionDao {
	@Resource
    private SaasAppSessionMapper saasAppSessionMapper;
	
	public boolean createSaasAppSession(SaasAppSession saasAppSession) {
        if (saasAppSession == null) {
            return false;
        }
        int res = saasAppSessionMapper.insert(saasAppSession);
        if (res == 1) {
            return true;
        }
        return false;
    }
	
	public SaasAppSession getAppSession(String sessionid) {
		 if (StringUtils.isBlank(sessionid)) {
	            return null;
	        }
	        return saasAppSessionMapper.selectByPrimaryKey(sessionid);
	}
	
	public boolean updateByPrimaryKey(SaasAppSession saasAppSession){
		if (saasAppSession == null) {
            return false;
        }
        int res = saasAppSessionMapper.updateByPrimaryKey(saasAppSession);
        if (res == 1) {
            return true;
        }
        return false;
	}
}
